#include"processtar.h"

char* rotate = "|/-\\";

void process_v1()
{
    int rate = 0;
    char tar[SIZE_TAR];
    memset(tar,'\0',sizeof(tar));
    int len = strlen(rotate);
    while(rate<=SIZE_RATE)
    {
        printf("[%-100s][%d%%][%c]\r",tar,rate,rotate[rate%len]);
        fflush(stdout);
        usleep(TSIZE);
        tar[rate++]=TYPE;
    }

    printf("\n");
}




void process_v2(int rate)
{
    static char tar[SIZE_TAR]= {0};
    static int cnt = 0;
    int len = strlen(rotate);
    if(rate<=SIZE_RATE && rate>0)
    {
        printf("[%-100s][%d%%][%c]\r",tar,rate,rotate[cnt%len]);
        fflush(stdout);
        tar[rate]=TYPE;
        cnt++;
    }

}
